From ba781eca74585ee6fc75d6945141e70384478557 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 10 Feb 2020 12:57:27 +0100 Subject: [PATCH] Expose gtk_icon_paintable_new_for_file --- docs/reference/gtk/gtk4-sections.txt | 1 + gtk/gtkicontheme.c | 14 +++++++++++++- gtk/gtkicontheme.h | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 3802214025..ac2e1a9b21 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -5009,6 +5009,7 @@ gtk_icon_theme_choose_icon_finish gtk_icon_theme_lookup_by_gicon gtk_icon_theme_list_icons gtk_icon_theme_get_icon_sizes +gtk_icon_paintable_new_for_file gtk_icon_paintable_get_file gtk_icon_paintable_get_icon_name gtk_icon_paintable_is_symbolic diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index b589fe2d51..92d7c43e36 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -3779,7 +3779,19 @@ icon_paintable_init (GdkPaintableInterface *iface) iface->get_intrinsic_height = icon_paintable_get_intrinsic_height; } -static GtkIconPaintable * +/** + * gtk_icon_paintable_new_for_file: + * @file: a #GFile + * @size: desired icon size + * @scale: the desired scale + * + * Creates a #GtkIconPaintable for a file with a given size and scale + * #GtkIcon. The icon can then be rendered by using it as a #GdkPaintable. + * + * Returns: (transfer full): a #GtkIconPaintable containing + * for the icon. Unref with g_object_unref() + */ +GtkIconPaintable * gtk_icon_paintable_new_for_file (GFile *file, gint size, gint scale) diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h index cf73c284cd..fbd34c3f83 100644 --- a/gtk/gtkicontheme.h +++ b/gtk/gtkicontheme.h @@ -134,6 +134,10 @@ GtkIconPaintable *gtk_icon_theme_lookup_by_gicon (GtkIconTheme GtkTextDirection direction, GtkIconLookupFlags flags); GDK_AVAILABLE_IN_ALL +GtkIconPaintable *gtk_icon_paintable_new_for_file (GFile *file, + gint size, + gint scale); +GDK_AVAILABLE_IN_ALL GList * gtk_icon_theme_list_icons (GtkIconTheme *self); GDK_AVAILABLE_IN_ALL -- 2.30.2